//
//  YITableViewFootView.m
//  一点互助
//
//  Created by rimi on 16/8/19.
//  Copyright © 2016年 shen. All rights reserved.
//

#import "YITableViewFootView.h"
#import "YIFootViewScrollView.h"
#import "YIBlessingDynamicCondition.h"
@interface YITableViewFootView()
{
       UIView *backView;
}


@property(nonatomic,strong)YIFootViewScrollView *scrollView;

@end
@implementation YITableViewFootView

-(instancetype)initWithFrame:(CGRect)frame{
       self = [super initWithFrame:frame];
       if (self) {
              
              [self backView];
              [self leftView];
              [self centerView];
              [self rightView];
              [self addSubview:self.scrollView];
       }
       return self;
}
-(void)backView{
       backView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, self.bounds.size.width, 140)];
       backView.backgroundColor = [UIColor whiteColor];
       [self addSubview:backView];
}


-(void)leftView{
       UIView *leftView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, self.bounds.size.width / 2 - 2, 110)];
       leftView.backgroundColor = [UIColor whiteColor];
       [backView addSubview:leftView];
       
       
       UIButton *leftButton = [UIButton buttonWithType:UIButtonTypeCustom];
       leftButton.frame = leftView.frame;
       leftButton.backgroundColor = [UIColor clearColor];
       [leftView addSubview:leftButton];
       [leftButton addTarget:self action:@selector(leftClick) forControlEvents:UIControlEventTouchUpInside];
       
       UILabel *todayAccumulative = [[UILabel alloc]initWithFrame:CGRectMake(20, 30, 100, 20)];
       todayAccumulative.text = @"今日累计数:";
       todayAccumulative.font = [UIFont systemFontOfSize:16];
       
       UILabel *count = [[UILabel alloc]initWithFrame:CGRectMake(20,80, 100, 20)];
       count.text = @"总：5000/元";
       count.font = [UIFont systemFontOfSize:13];
       
       UIImageView *moneyIcon = [[UIImageView alloc]initWithFrame:CGRectMake(120, 40, 60, 60)];
       moneyIcon.image = [UIImage imageNamed:@"福袋"];
       
       [leftView addSubview:todayAccumulative];
       [leftView addSubview:moneyIcon];
       [leftView addSubview:count];
       

       
}
-(void)leftClick{
       YIBlessingDynamicCondition *blessingDC = [[YIBlessingDynamicCondition alloc]init];
       YIFatherVC *vc = [[YIFatherVC alloc]init];
       [[vc superVC:self].navigationController pushViewController:blessingDC animated:YES];

}
-(void)centerView{
       UIView *centerView = [[UIView alloc]initWithFrame:CGRectMake(self.bounds.size.width / 2+2 , 0, 2, 100)];
       centerView.backgroundColor = [UIColor grayColor];
       [backView addSubview:centerView];
}
-(void)rightView{
       UIView *rightView = [[UIView alloc]initWithFrame:CGRectMake(self.bounds.size.width / 2 + 8, 20, self.bounds.size.width / 2 + 2, 110)];
       rightView.backgroundColor = [UIColor whiteColor];
       [backView addSubview:rightView];
       
       UIImageView *smallMoneyIcon = [[UIImageView alloc]initWithFrame:CGRectMake(10, 10, 20, 20)];
       smallMoneyIcon.image = [UIImage imageNamed:@"钱袋"];
       UILabel *moneyAmount = [[UILabel alloc]initWithFrame:CGRectMake(40, 10, 140, 20)];
       moneyAmount.font = [UIFont systemFontOfSize:16];
       moneyAmount.text = @"福包累计总额：";
       
       UILabel *moneyAmountDetailed = [[UILabel alloc]initWithFrame:CGRectMake(20, 60, 100, 20)];
       moneyAmountDetailed.text = @"2558/万元";
       moneyAmountDetailed.font = [UIFont systemFontOfSize:18];
       
       UIImageView *progressBar = [[UIImageView alloc]initWithFrame:CGRectMake(10, 100, 110, 40)];
       progressBar.image = [UIImage imageNamed:@"3"];
       
       
       [rightView addSubview:smallMoneyIcon];
       [rightView addSubview:moneyAmount];
       [rightView addSubview:moneyAmountDetailed];
       [rightView addSubview:progressBar];
}
-(YIFootViewScrollView *)scrollView{
       if (!_scrollView) {
              _scrollView = [[YIFootViewScrollView alloc]initWithFrame:self.bounds];
       }
       return _scrollView;
}

@end
